﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ASCalpuff.FileLayers
{
    public class MG5:Group
    {

        // Fields

        //风场模型选项WIND FIELD MODEL OPTIONS
        /// <summary>
        /// 风场模型
        /// 0 = 客观分析风场
        /// 1 = 诊断风场
        /// </summary>
        private int m_IWFCOD = 1;


        /// <summary>
        /// 是否计算弗洛德数调整
        /// </summary>
        private int m_IFRADJ = 1;

        /// <summary>
        /// 是否计算运动学效应影响kinematic effects
        /// </summary>
        private int m_IKINE = 0;
        /// <summary>
        /// 是否使用 O'Brien procedure 调整
        /// </summary>
        private int m_IOBR = 1;


        /// <summary>
        /// 是否使用坡风调整
        /// </summary>
        private int m_ISLOPE = 1;

        /// <summary>
        /// 由地面风场观测数据外推探空数据
        /// 1,不适用外推,
        /// 2,指数 power law extrapolation
        /// 3,user input multiplicative factors  For layers 2 - NZ used (see FEXTRP array)
        /// 4 =使用相似理论 similarity theory 
        /// -1, -2, -3, -4 = same as above except layer 1 data at upper air stations are ignored
        /// </summary>
        private int m_IEXTRP = -4;


        /// <summary>
        /// 即使静风是否也外推地面风场,(0 = NO, 1 = YES)
        /// </summary>
        private int m_ICALM = 0;

        /// <summary>
        ///每层地面和探空站所占的权重
        ///负值降低探空站的权重 (e.g. BIAS=-0.1 降低探空站的权重10%,BIAS= -1, 降低探空站的权重 100 %)
        ///正值降低探空站的权重  (e.g. BIAS= 0.2 降低地面站的权重20%
        /// </summary>
        List<double> m_BIAS = new List<double>();

        /// <summary>
        /// 地面站外推探空数据允许的最小距离
        /// </summary>
        private double m_RMIN2 = 4;

        //使用网格预测风场作为诊断风场的输入的控制参数
        //=0，不适用
        //=1 使用 CSUMM 预测场作为步骤1的风场, [IWFCOD = 0]
        //= 2 使用CSUMM预测场作为初始猜测场 [IWFCOD = 1]
        //=3  使用 MM4 预测场作为步骤1的风场, [IWFCOD = 0]
        //4 = 使用MM4预测场作为初始猜测 [IWFCOD = 1]
        //5 = 使用MM4预测场作为观测数据 [IWFCOD = 1]
        //13 =使用 MM5 预测场作为步骤1的风场, [IWFCOD = 0]
        //14 =使用MM5预测场作为初始猜测 [IWFCOD = 1]
        //15 =使用MM5预测场作为观测数据 [IWFCOD = 1]
        private int m_IPROG = 0;


        /// <summary>
        /// 预测风场的时间间隔 单位：秒
        /// </summary>
        private int m_ISTEPPGS = 3600;


        /// <summary>
        /// 使用calmet风场作为初始猜测场
        /// </summary>
        private int m_IGFMET = 0;


        //参数的影响半径RADIUS OF INFLUENCE PARAMETERS

        /// <summary>
        /// 是否使用不同的影响半径,如果没有气象站在指定影响半径内具有有效数据，那么最近的气象站将被用到
        /// </summary>
        private bool m_LVARY = false;


        /// <summary>
        /// 陆面最小影响半径，单位：km
        /// </summary>
        private double m_RMAX1 = 10;
        /// <summary>
        /// 陆面最大影响半径，单位：km
        /// </summary>
        private double m_RMAX2 = 10;
        /// <summary>
        /// 海面的最大影响半径
        /// </summary>
        private double m_RMAX3 = 50;


        /// <summary>
        /// 风场插值的最小影响半径，这个值应该小于1KM，否则可能产生插值错误
        /// </summary>
        private double m_RMIN = 0.1;

        /// <summary>
        /// 地形特征影响的半径，单位：km
        /// </summary>
        private double m_TERRAD = 12;
        /// <summary>
        /// 初始猜测场(由诊断风场模型得出的)和观测数据在地面层的相对权重。
        /// R1为观测站与初始猜测场权重相等的距离，单位：km
        /// </summary>
        private double m_R1 = 1;
        /// <summary>
        /// 初始猜测场和观测数据在浮力层的相对权重。(R2 在高空层的作用方式与R1在地面层相同，单位：km
        /// </summary>
        private double m_R2 = 1;


        /// <summary>
        /// 预测风场权重参数，(Used only if IPROG = 1)              Units: km
        /// </summary>
        private double m_RPROG = 0;

        /// <summary>
        /// 偏差最小化的收敛判别标准
        /// </summary>
        private double m_DIVLIM = 5E-06;

        /// <summary>
        /// 偏差最小化过程中最大迭代次数
        /// </summary>
        private int m_NITER = 50;



        /// <summary>
        /// 每层中平滑过程中的次数，必须输入NZ值
        /// </summary>
        private List<int> m_NSMTH = new List<int>();


        /// <summary>
        /// 对于单个网格点而言内插数据使用到的最大气象站数，默认99，必须输入NZ
        /// </summary>
        List<int> m_NINTR2 = new List<int>();

        /// <summary>
        /// 临界Froude弗洛德数
        /// </summary>

        private double m_CRITFN = 1.0;

        /// <summary>
        /// 运动学效应的经验控制参数
        /// </summary>
        private double m_ALPHA = 0.1;


        //地面数据外推探空数据多种尺度参数,第二层到NZ的外推值 绝对值IEXTRP>3 有效
        //private double[] m_FEXTR2 = new double[0];
        List<double> m_FEXTR2 = new List<double>();



        //BARRIER INFORMATION



        /// <summary>
        /// Level (1 to NZ) up to which barriers  apply
        /// </summary>
        private int m_KBAR = 7;

        //风场内插的障碍数目
        private int m_NBAR = 0;


        private List<Barrier> m_ArryBarrier = new List<Barrier>();
        /// <summary>
        /// 屏障集合
        /// </summary>
        public List<Barrier> ArryBarrier
        {
            get { return m_ArryBarrier; }
            set { m_ArryBarrier = value; }
        }



        //诊断风场模块地面温度场输入的控制变量



        /// <summary>
        /// 地面温度
        /// 0 = 从站点数据或者预测场内插计算
        /// =1，从外部文件读入 (DIAG.DAT)
        /// </summary>
        private int m_IDIOPT1 = 0;

        /// <summary>
        /// 地面温度计算使用到的地面气象数据站点个数
        /// = -1 ，使用2D空间变化的地面温度内插计算
        /// =-2，使用区域平均预测地面温度(only with ITPROG=2))
        /// </summary>
        private int m_ISURFT = 2;
        /// <summary>
        /// 计算地形导致的循环使用的温度递减率
        /// 0 = 从探空站点或预测场内插计算
        /// =1 ,从小时预处理文件中读取 (DIAG.DAT)
        /// </summary>
        private int m_IDIOPT2 = 0;



        /// <summary>
        /// 诊断风场模块计算区域平均温度递减率数据的高空站点的数目(1和NUSTA)
        /// = -1，使用2D空间变化的递减率
        /// =-2，使用区域平均的预测递减率(only with ITPROG>0))
        /// (Used only if IDIOPT2 = 0)
        /// </summary>
        private int m_IUPT = 1;

        /// <summary>
        /// 区域尺度的递减率计算的深度，单位：m
        /// </summary>
        private double m_ZUPT = 200.0;


        //初始猜测场Initial Guess Field Winds




        /// <summary>
        /// 初始猜测风场分量的控制变量 0,1
        /// = 0，从观测或者预测场中计算
        /// =1，从小时预处理文件(DIAG.DAT)读取
        /// </summary>
        private int m_IDIOPT3 = 0;

        //诊断风场模块中计算初始猜测风场分量时采用的高空探测站点数目
        private int m_IUPWND = -1;

        /// <summary>
        /// 最小和最大高度在计算区域尺度风场
        /// (Used only if IDIOPT3 = 0, NOOBS>0 and IUPWND>0)    Units: meters,默认值1,1000
        /// </summary>
        private List<double> m_ZUPWND = new List<double>();



        //地面风Observed surface wind components
        /// <summary>
        /// 地面气象数据的来源
        /// 0，从 SURF.DAT中读取
        /// 1，从小时预处理文件中 (DIAG.DAT)读取
        /// </summary>
        private int m_IDIOPT4 = 0;
        /// <summary>
        /// 探空气象数据的来源
        /// 0，从upDAT中读取
        /// =1，从小时预处理文件中 (DIAG.DAT)读取
        /// </summary>
        private int m_IDIOPT5 = 0;


        //湖冰选项LAKE BREEZE INFORMATION


        /// <summary>
        /// 使用湖冰模型
        /// </summary>
        private bool m_LLBREZE = false;



        /// <summary>
        /// 界定区域所采用的区域数目
        /// </summary>
        private int m_NBOX = 0;


        ///// <summary>
        ///// 起点X网格
        ///// </summary>
        //private List<double> m_XG1 = new List<double>();
        ///// <summary>
        ///// 起点Y网格
        ///// </summary>
        //private List<double> m_XG2 = new List<double>();

        ///// <summary>
        ///// 终点X网格
        ///// </summary>
        //private List<double> m_YG1 = new List<double>();
        ///// <summary>
        ///// 终点Y网格
        ///// </summary>
        //private List<double> m_YG2 = new List<double>();



        ///// <summary>
        ///// 用户确定的海岸线起始X坐标
        ///// </summary>
        //private List<double> m_XBCST = new List<double>();
        ///// <summary>
        ///// 用户确定的海岸线起始Y坐标
        ///// </summary>
        //private List<double> m_YBCST = new List<double>();
        ///// <summary>
        ///// 用户确定的海岸结束X坐标
        ///// </summary>
        //private List<double> m_XECST = new List<double>();
        ///// <summary>
        ///// 用户确定的海岸线结束Y坐标
        ///// </summary>
        //private List<double> m_YECST = new List<double>();


        ///// <summary>
        ///// 每个箱体中地面站和探空站在湖冰区域内的个数
        ///// </summary>
        //List<int> m_NLB = new List<int>();



        ///// <summary>
        ///// 每个箱体中气象站点的编号,先地面站，后探空站
        ///// </summary>
        //List<int> m_METBXID = new List<int>();       

        //private double[] m_FEXTR2 = new double[0];

        // private METBXID[] m_nMETBXID = new METBXID[0];

        /// <summary>
        /// 湖区集合
        /// </summary>
        private List<Lake> m_ArryLake = new List<Lake>();
        /// <summary>
        /// 湖区集合
        /// </summary>
        public List<Lake> ArryLake
        {
            get { return m_ArryLake; }
            set { m_ArryLake = value; }
        }


        private bool m_Uniform = false;
        private bool m_WindFiled = false;




        #region 对应的属性

        // Properties
        public double ALPHA
        {
            get
            {
                return this.m_ALPHA;
            }
            set
            {
                this.m_ALPHA = value;
            }
        }

        public List<double> BIAS
        {
            get
            {
                return this.m_BIAS;
            }
            set
            {
                this.m_BIAS = value;
            }
        }

        public double CRITFN
        {
            get
            {
                return this.m_CRITFN;
            }
            set
            {
                this.m_CRITFN = value;
            }
        }

        public double DIVLIM
        {
            get
            {
                return this.m_DIVLIM;
            }
            set
            {
                this.m_DIVLIM = value;
            }
        }

        public List<double> FEXTR2
        {
            get
            {
                return this.m_FEXTR2;
            }
            set
            {
                this.m_FEXTR2 = value;
            }
        }

        public int ICALM
        {
            get
            {
                return this.m_ICALM;
            }
            set
            {
                this.m_ICALM = value;
            }
        }

        public int IDIOPT1
        {
            get
            {
                return this.m_IDIOPT1;
            }
            set
            {
                this.m_IDIOPT1 = value;
            }
        }

        public int IDIOPT2
        {
            get
            {
                return this.m_IDIOPT2;
            }
            set
            {
                this.m_IDIOPT2 = value;
            }
        }

        public int IDIOPT3
        {
            get
            {
                return this.m_IDIOPT3;
            }
            set
            {
                this.m_IDIOPT3 = value;
            }
        }

        public int IDIOPT4
        {
            get
            {
                return this.m_IDIOPT4;
            }
            set
            {
                this.m_IDIOPT4 = value;
            }
        }

        public int IDIOPT5
        {
            get
            {
                return this.m_IDIOPT5;
            }
            set
            {
                this.m_IDIOPT5 = value;
            }
        }

        public int IEXTRP
        {
            get
            {
                return this.m_IEXTRP;
            }
            set
            {
                this.m_IEXTRP = value;
            }
        }

        public int IFRADJ
        {
            get
            {
                return this.m_IFRADJ;
            }
            set
            {
                this.m_IFRADJ = value;
            }
        }

        public int IGFMET
        {
            get
            {
                return this.m_IGFMET;
            }
            set
            {
                this.m_IGFMET = value;
            }
        }

        public int IKINE
        {
            get
            {
                return this.m_IKINE;
            }
            set
            {
                this.m_IKINE = value;
            }
        }

        public int IOBR
        {
            get
            {
                return this.m_IOBR;
            }
            set
            {
                this.m_IOBR = value;
            }
        }

        public int IPROG
        {
            get
            {
                return this.m_IPROG;
            }
            set
            {
                this.m_IPROG = value;
            }
        }

        public int ISLOPE
        {
            get
            {
                return this.m_ISLOPE;
            }
            set
            {
                this.m_ISLOPE = value;
            }
        }

        public int ISTEPPGS
        {
            get
            {
                return this.m_ISTEPPGS;
            }
            set
            {
                this.m_ISTEPPGS = value;
            }
        }

        public int ISURFT
        {
            get
            {
                return this.m_ISURFT;
            }
            set
            {
                this.m_ISURFT = value;
            }
        }

        public int IUPT
        {
            get
            {
                return this.m_IUPT;
            }
            set
            {
                this.m_IUPT = value;
            }
        }

        public int IUPWND
        {
            get
            {
                return this.m_IUPWND;
            }
            set
            {
                this.m_IUPWND = value;
            }
        }

        public int IWFCOD
        {
            get
            {
                return this.m_IWFCOD;
            }
            set
            {
                this.m_IWFCOD = value;
            }
        }

        public int KBAR
        {
            get
            {
                return this.m_KBAR;
            }
            set
            {
                this.m_KBAR = value;
            }
        }

        public bool LLBREZE
        {
            get
            {
                return this.m_LLBREZE;
            }
            set
            {
                this.m_LLBREZE = value;
            }
        }

        public bool LVARY
        {
            get
            {
                return this.m_LVARY;
            }
            set
            {
                this.m_LVARY = value;
            }
        }

        public int NBAR
        {
            get
            {
                return this.m_NBAR;
            }
            set
            {
                this.m_NBAR = value;
            }
        }

        public int NBOX
        {
            get
            {
                return this.m_NBOX;
            }
            set
            {
                this.m_NBOX = value;
            }
        }

        public List<int> NINTR2
        {
            get
            {
                return this.m_NINTR2;
            }
            set
            {
                this.m_NINTR2 = value;
            }
        }

        public int NITER
        {
            get
            {
                return this.m_NITER;
            }
            set
            {
                this.m_NITER = value;
            }
        }

        //public List<int> NLB
        //{
        //    get
        //    {
        //        return this.m_NLB;
        //    }
        //    set
        //    {
        //        this.m_NLB = value;
        //    }
        //}

        //public METBXID[] nMETBXID
        //{
        //    get
        //    {
        //        return this.m_nMETBXID;
        //    }
        //    set
        //    {
        //        this.m_nMETBXID = value;
        //    }
        //}

        public List<int> NSMTH
        {
            get
            {
                return this.m_NSMTH;
            }
            set
            {
                this.m_NSMTH = value;
            }
        }

        public double R1
        {
            get
            {
                return this.m_R1;
            }
            set
            {
                this.m_R1 = value;
            }
        }

        public double R2
        {
            get
            {
                return this.m_R2;
            }
            set
            {
                this.m_R2 = value;
            }
        }

        public double RMAX1
        {
            get
            {
                return this.m_RMAX1;
            }
            set
            {
                this.m_RMAX1 = value;
            }
        }

        public double RMAX2
        {
            get
            {
                return this.m_RMAX2;
            }
            set
            {
                this.m_RMAX2 = value;
            }
        }

        public double RMAX3
        {
            get
            {
                return this.m_RMAX3;
            }
            set
            {
                this.m_RMAX3 = value;
            }
        }

        public double RMIN
        {
            get
            {
                return this.m_RMIN;
            }
            set
            {
                this.m_RMIN = value;
            }
        }

        public double RMIN2
        {
            get
            {
                return this.m_RMIN2;
            }
            set
            {
                this.m_RMIN2 = value;
            }
        }

        public double RPROG
        {
            get
            {
                return this.m_RPROG;
            }
            set
            {
                this.m_RPROG = value;
            }
        }

        public double TERRAD
        {
            get
            {
                return this.m_TERRAD;
            }
            set
            {
                this.m_TERRAD = value;
            }
        }

        public bool Uniform
        {
            get
            {
                return this.m_Uniform;
            }
            set
            {
                this.m_Uniform = value;
            }
        }

        public bool WindFiled
        {
            get
            {
                return this.m_WindFiled;
            }
            set
            {
                this.m_WindFiled = value;
            }
        }



        //public List<double> XBCST
        //{
        //    get
        //    {
        //        return this.m_XBCST;
        //    }
        //    set
        //    {
        //        this.m_XBCST = value;
        //    }
        //}



        //public List<double> XECST
        //{
        //    get
        //    {
        //        return this.m_XECST;
        //    }
        //    set
        //    {
        //        this.m_XECST = value;
        //    }
        //}

        //public List<double> XG1
        //{
        //    get
        //    {
        //        return this.m_XG1;
        //    }
        //    set
        //    {
        //        this.m_XG1 = value;
        //    }
        //}

        //public List<double> XG2
        //{
        //    get
        //    {
        //        return this.m_XG2;
        //    }
        //    set
        //    {
        //        this.m_XG2 = value;
        //    }
        //}



        //public List<double> YBCST
        //{
        //    get
        //    {
        //        return this.m_YBCST;
        //    }
        //    set
        //    {
        //        this.m_YBCST = value;
        //    }
        //}



        //public List<double> YECST
        //{
        //    get
        //    {
        //        return this.m_YECST;
        //    }
        //    set
        //    {
        //        this.m_YECST = value;
        //    }
        //}

        //public List<double> YG1
        //{
        //    get
        //    {
        //        return this.m_YG1;
        //    }
        //    set
        //    {
        //        this.m_YG1 = value;
        //    }
        //}

        //public List<double> YG2
        //{
        //    get
        //    {
        //        return this.m_YG2;
        //    }
        //    set
        //    {
        //        this.m_YG2 = value;
        //    }
        //}

        public double ZUPT
        {
            get
            {
                return this.m_ZUPT;
            }
            set
            {
                this.m_ZUPT = value;
            }
        }

        public List<double> ZUPWND
        {
            get
            {
                return this.m_ZUPWND;
            }
            set
            {
                this.m_ZUPWND = value;
            }
        }


        private int m_CboISURFT = 0;
        /// <summary>
        /// 地面温度数据
        /// </summary>
        public int CboISURFT
        {
            get { return m_CboISURFT; }
            set { m_CboISURFT = value; }
        }

        private int m_CboIUPT = 0;
        /// <summary>
        /// 探空温度数据
        /// </summary>
        public int CboIUPT
        {
            get { return m_CboIUPT; }
            set { m_CboIUPT = value; }
        }


        //public List<int> METBXID
        //{
        //    get
        //    {
        //        return this.m_METBXID;
        //    }
        //    set
        //    {
        //        this.m_METBXID = value;
        //    }
        //}

     

        #endregion

        public override string WriteToGroup()
        {
            //string Str = "-------------------------------------------------------------------------------\r\nINPUT GROUP: 5 -- Wind Field Options and Parameters\r\n-------------------------------------------------------------------------------\r\n";
            //string mEnd = "  !";
            //Str = Str + "! IWFCOD =  " + this.IWFCOD.ToString() + mEnd + "\r\n! IFRADJ =  " + this.IFRADJ.ToString() + mEnd + "\r\n! IKINE  =  " + this.IKINE.ToString() + mEnd + "\r\n! IOBR =  " + this.IOBR.ToString() + mEnd + "\r\n! ISLOPE  =  " + this.ISLOPE.ToString() + mEnd + "\r\n! IEXTRP = " + this.IEXTRP.ToString() + mEnd + "\r\n! ICALM  =  " + this.ICALM.ToString() + mEnd + "\r\n";
            //string mBias = "! BIAS =";
            //int VBst_i4sL7 = this.BIAS.Length - 1;
            //for (int i = 0; i <= VBst_i4sL7; i++)
            //{
            //    mBias = mBias + "  " + this.BIAS[i].ToString() + " ,";
            //}
            //Str = Str + mBias.Remove(mBias.Length - 1, 1) + "  !\r\n";
            //Str = Str + "! RMIN2 = " + this.RMIN2.ToString() + mEnd + "\r\n! IPROG =  " + this.IPROG.ToString() + mEnd + "\r\n! ISTEPPGS =  " + this.ISTEPPGS.ToString() + mEnd + "\r\n! IGFMET =  " + this.IGFMET.ToString() + mEnd + "\r\n! LVARY =  " + this.LVARY + mEnd + "\r\n! RMAX1 = " + this.RMAX1.ToString() + mEnd + "\r\n! RMAX2 = " + this.RMAX2.ToString() + mEnd + "\r\n! RMAX3 = " + this.RMAX3.ToString() + mEnd + "\r\n! RMIN = " + this.RMIN.ToString() + mEnd + "\r\n! TERRAD = " + this.TERRAD.ToString() + mEnd + "\r\n! R1 = " + this.R1.ToString() + mEnd + "\r\n! R2 = " + this.R2.ToString() + mEnd + "\r\n! RPROG = " + this.RPROG.ToString() + mEnd + "\r\n! DIVLIM= " + this.DIVLIM.ToString() + mEnd + "\r\n! NITER =  " + this.NITER.ToString() + mEnd + "\r\n";
            //string mNsmth = "! NSMTH =";
            //int VBst_i4sL8 = this.NSMTH.Length - 1;
            //for (int i = 0; i <= VBst_i4sL8; i++)
            //{
            //    mNsmth = mNsmth + "  " + this.NSMTH[i].ToString() + " ,";
            //}
            //Str = Str + mNsmth.Remove(mNsmth.Length - 1, 1) + "  !\r\n";
            //string mNintr2 = "! NINTR2 =";
            //int VBst_i4sL9 = this.NINTR2.Length - 1;
            //for (int i = 0; i <= VBst_i4sL9; i++)
            //{
            //    mNintr2 = mNintr2 + "  " + this.NINTR2[i].ToString() + " ,";
            //}
            //Str = Str + mNintr2.Remove(mNintr2.Length - 1, 1) + "  !\r\n";
            //Str = Str + "! CRITFN = " + this.CRITFN.ToString() + mEnd + "\r\n! ALPHA = " + this.ALPHA.ToString() + mEnd + "\r\n";
            //string mFextr2 = "! FEXTR2 =";
            //int VBst_i4sL10 = this.FEXTR2.Length - 1;
            //for (int i = 0; i <= VBst_i4sL10; i++)
            //{
            //    mFextr2 = mFextr2 + " " + this.FEXTR2[i].ToString() + ",";
            //}
            //Str = Str + mFextr2.Remove(mFextr2.Length - 1, 1) + " !\r\n";
            //Str = Str + "! NBAR =  " + this.NBAR.ToString() + mEnd + "\r\n! KBAR =  " + this.KBAR.ToString() + mEnd + "\r\n";
            //if ((this.XBBAR != null) & (this.XBBAR.Length > 0))
            //{
            //    string mXBBAR = "";
            //    string mYBBAR = "";
            //    string mXEBAR = "";
            //    string mYEBAR = "";
            //    int VBst_i4sL11 = this.XBBAR.Length - 1;
            //    for (int i = 0; i <= VBst_i4sL11; i++)
            //    {
            //        mXBBAR = mXBBAR + " " + Convert .ToString(this.XBBAR[i]) + ",";
            //        mYBBAR = mYBBAR + " " + Convert.ToString(this.YBBAR[i]) + ",";
            //        mXEBAR = mXEBAR + " " + Convert.ToString(this.XEBAR[i]) + ",";
            //        mYEBAR = mYEBAR + " " + Convert.ToString(this.YEBAR[i]) + ",";
            //    }
            //    Str = Str + "! XBBAR =" + mXBBAR.Remove(mXBBAR.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! YBBAR =" + mYBBAR.Remove(mYBBAR.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! XEBAR =" + mXEBAR.Remove(mXEBAR.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! YEBAR =" + mYEBAR.Remove(mYEBAR.Length - 1, 1) + mEnd + "\r\n";
            //}
            //else
            //{
            //    Str = (((Str + "! XBBAR = 0" + mEnd + "\r\n") + "! YBBAR = 0" + mEnd + "\r\n") + "! XEBAR = 0" + mEnd + "\r\n") + "! YEBAR = 0" + mEnd + "\r\n";
            //}
            //Str = Str + "! IDIOPT1 =  " + this.IDIOPT1.ToString() + mEnd + "\r\n! ISURFT =  " + this.ISURFT.ToString() + mEnd + "\r\n! IDIOPT2 =  " + this.IDIOPT2.ToString() + mEnd + "\r\n! IUPT   =  " + this.IUPT.ToString() + mEnd + "\r\n! ZUPT = " + this.ZUPT.ToString() + mEnd + "\r\n! IDIOPT3 =  " + this.IDIOPT3.ToString() + mEnd + "\r\n! IUPWND = " + this.IUPWND.ToString() + mEnd + "\r\n! ZUPWND= " + this.ZUPWND[0].ToString() + "," + this.ZUPWND[1].ToString() + mEnd + "\r\n! IDIOPT4 =  " + this.IDIOPT4.ToString() + mEnd + "\r\n! IDIOPT5 =  " + this.IDIOPT5.ToString() + mEnd + "\r\n! LLBREZE = " + this.LLBREZE + mEnd + "\r\n! NBOX =  " + this.NBOX.ToString() + mEnd + "\r\n";
            //if ((this.XG1 != null) & (this.XG1.Length > 0))
            //{
            //    string mXG1 = "";
            //    string mXG2 = "";
            //    string mYG1 = "";
            //    string mYG2 = "";
            //    string mXBCST = "";
            //    string mYBCST = "";
            //    string mXECST = "";
            //    string mYECST = "";
            //    string mNLB = "";
            //    int VBst_i4sL14 = this.XG1.Length - 1;
            //    for (int i = 0; i <= VBst_i4sL14; i++)
            //    {
            //        mXG1 = mXG1 + " " + this.XG1[i].ToString() + ",";
            //        mXG2 = mXG2 + " " + this.XG2[i].ToString() + ",";
            //        mYG1 = mYG1 + " " + this.YG1[i].ToString() + ",";
            //        mYG2 = mYG2 + " " + this.YG2[i].ToString() + ",";
            //        mXBCST = mXBCST + " " + this.XBCST[i].ToString() + ",";
            //        mYBCST = mYBCST + " " + this.YBCST[i].ToString() + ",";
            //        mXECST = mXECST + " " + this.XECST[i].ToString() + ",";
            //        mYECST = mYECST + " " + this.YECST[i].ToString() + ",";
            //        mNLB = mNLB + " " + this.NLB[i].ToString() + ",";
            //    }
            //    Str = Str + "! XG1 =" + mXG1.Remove(mXG1.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! XG2 =" + mXG2.Remove(mXG2.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! YG1 =" + mYG1.Remove(mYG1.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! YG2 =" + mYG2.Remove(mYG2.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! XBCST =" + mXBCST.Remove(mXBCST.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! YBCST =" + mYBCST.Remove(mYBCST.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! XECST =" + mXECST.Remove(mXECST.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! YECST =" + mYECST.Remove(mYECST.Length - 1, 1) + mEnd + "\r\n";
            //    Str = Str + "! NLB =" + mNLB.Remove(mNLB.Length - 1, 1) + mEnd + "\r\n";
            //    //string mMETBXID = "";
            //    //int VBst_i4sL15 = this.nMETBXID.Length - 1;
            //    //for (int i = 0; i <= VBst_i4sL15; i++)
            //    //{
            //    //    int VBst_i4sL16 = this.nMETBXID[i].METBXID.Length - 1;
            //    //    for (int j = 0; j <= VBst_i4sL16; j++)
            //    //    {
            //    //        mMETBXID = mMETBXID + "  " + Conversions.ToString(this.nMETBXID[i].METBXID[i]) + " ,";
            //    //    }
            //    //}
            //    //Str = Str + "! METBXID =" + mMETBXID.Remove(mMETBXID.Length - 1, 1) + mEnd + "\r\n";
            //}
            //else
            //{
            //    Str = (((((((((Str + "! XG1 = 0" + mEnd + "\r\n") + "! XG2 = 0" + mEnd + "\r\n") + "! YG1 = 0" + mEnd + "\r\n") + "! YG2 = 0" + mEnd + "\r\n") + "! XBCST = 0" + mEnd + "\r\n") + "! YBCST = 0" + mEnd + "\r\n") + "! XECST = 0" + mEnd + "\r\n") + "! YECST = 0" + mEnd + "\r\n") + "! NLB =  0" + mEnd + "\r\n") + "! METBXID =  0" + mEnd + "\r\n";
            //}
            //return (Str + "!END!\r\n");

            string ResultStr = "", TempStr;
            string End = "\r\n";

            TempStr = "INPUT GROUP: 5 -- Wind Field Options and Parameters" + End;
            ResultStr += TempStr;

            TempStr = "--------------" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IWFCOD", IWFCOD.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IFRADJ", IFRADJ.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IKINE", IKINE.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IOBR", IOBR.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("ISLOPE", ISLOPE.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IEXTRP", IEXTRP.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("ICALM", ICALM.ToString());
            ResultStr += TempStr;

            TempStr = "! BIAS =";
            int j = 0;
            foreach (int i in BIAS)
            {
                if (j < BIAS.Count - 1)
                    TempStr += i.ToString() + " ,";
                else
                    TempStr += i.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("RMIN2", RMIN2.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IPROG", IPROG.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("ISTEPPGS", ISTEPPGS.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IGFMET", IGFMET.ToString());
            ResultStr += TempStr;

            if (LVARY == true)
                TempStr = "! LVARY = " + "T !" + End;
            else
                TempStr = "! LVARY = " + "F !" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("RMAX1", RMAX1.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("RMAX2", RMAX2.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("RMAX3", RMAX3.ToString());
            ResultStr += TempStr;

            TempStr = "OTHER WIND FIELD INPUT PARAMETERS" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("RMIN", RMIN.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("TERRAD", TERRAD.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("R1", R1.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("R2", R2.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("RPROG", RPROG.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("DIVLIM", DIVLIM.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("NITER", NITER.ToString());
            ResultStr += TempStr;


            TempStr = "! NSMTH =";
            j = 0;
            foreach (int i in NSMTH)
            {
                if (j < NSMTH.Count - 1)
                    TempStr += i.ToString() + " ,";
                else
                    TempStr += i.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            TempStr = "! NINTR2 =";
            j = 0;
            foreach (int i in NINTR2)
            {
                if (j < NINTR2.Count - 1)
                    TempStr += i.ToString() + " ,";
                else
                    TempStr += i.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("CRITFN", CRITFN.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("ALPHA", ALPHA.ToString());
            ResultStr += TempStr;

            TempStr = "! FEXTR2 =";
            j = 0;
            foreach (int i in FEXTR2)
            {
                if (j < FEXTR2.Count - 1)
                    TempStr += i.ToString() + " ,";
                else
                    TempStr += i.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            TempStr = "BARRIER INFORMATION" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("NBAR", NBAR.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("KBAR", KBAR.ToString());
            ResultStr += TempStr;



            TempStr = "! XBBAR =";
            j = 0;
            foreach (Barrier i in ArryBarrier)
            {
                if (j < ArryBarrier.Count - 1)
                    TempStr += Math.Round(i.XBBAR, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.XBBAR, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;



            //TempStr = StrWriter.GetKeyValStr("XBBAR", XBBAR.ToString());
            //ResultStr += TempStr;

            TempStr = "! YBBAR =";
            j = 0;
            foreach (Barrier i in ArryBarrier)
            {
                if (j < ArryBarrier.Count - 1)
                    TempStr += Math.Round(i.YBBAR, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.YBBAR, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            //TempStr = StrWriter.GetKeyValStr("YBBAR", YBBAR.ToString());
            //ResultStr += TempStr;


            TempStr = "! XEBAR =";
            j = 0;
            foreach (Barrier i in ArryBarrier)
            {
                if (j < ArryBarrier.Count - 1)
                    TempStr += Math.Round(i.XEBAR, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.XEBAR, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            //TempStr = StrWriter.GetKeyValStr("XEBAR", XEBAR.ToString());
            //ResultStr += TempStr;

            TempStr = "! YEBAR =";
            j = 0;
            foreach (Barrier i in ArryBarrier)
            {
                if (j < ArryBarrier.Count - 1)
                    TempStr += Math.Round(i.YEBAR, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.YEBAR, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            //TempStr = StrWriter.GetKeyValStr("YEBAR", YEBAR.ToString());
            //ResultStr += TempStr;









            TempStr = "DIAGNOSTIC MODULE DATA INPUT OPTIONS" + End;
            ResultStr += TempStr;


            TempStr = StrWriter.GetKeyValStr("IDIOPT1", IDIOPT1.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("ISURFT", ISURFT.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IDIOPT2", IDIOPT2.ToString());
            ResultStr += TempStr;


            TempStr = StrWriter.GetKeyValStr("IUPT", IUPT.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("ZUPT", ZUPT.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IDIOPT3", IDIOPT3.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IUPWND", IUPWND.ToString());
            ResultStr += TempStr;


            TempStr = "! ZUPWND =";
            j = 0;
            foreach (double i in ZUPWND)
            {
                if (j < ZUPWND.Count - 1)
                    TempStr += i.ToString() + " ,";
                else
                    TempStr += i.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            TempStr = StrWriter.GetKeyValStr("IDIOPT4", IDIOPT4.ToString());
            ResultStr += TempStr;

            TempStr = StrWriter.GetKeyValStr("IDIOPT5", IDIOPT5.ToString());
            ResultStr += TempStr;

            TempStr = "LAKE BREEZE INFORMATION" + End;
            ResultStr += TempStr;


            if (LLBREZE == true)
                TempStr = "! LLBREZE= T !" + End;
            else
                TempStr = "! LLBREZE= F !" + End;
            ResultStr += TempStr;



            TempStr = StrWriter.GetKeyValStr("NBOX", NBOX.ToString());
            ResultStr += TempStr;



            TempStr = "! XG1 =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += i.XG1.ToString() + " ,";
                else
                    TempStr += i.XG1.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            //TempStr = StrWriter.GetKeyValStr("XG1", XG1.ToString());
            //ResultStr += TempStr;


            TempStr = "! XG2 =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += i.XG2.ToString() + " ,";
                else
                    TempStr += i.XG2.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            //TempStr = StrWriter.GetKeyValStr("XG2", XG2.ToString());
            //ResultStr += TempStr;

            TempStr = "! YG1 =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += i.YG1.ToString() + " ,";
                else
                    TempStr += i.YG1.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            //TempStr = StrWriter.GetKeyValStr("YG1", YG1.ToString());
            //ResultStr += TempStr;

            TempStr = "! YG2 =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += i.YG2.ToString() + " ,";
                else
                    TempStr += i.YG2.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            //TempStr = StrWriter.GetKeyValStr("YG2", YG2.ToString());
            //ResultStr += TempStr;


            TempStr = "! XBCST =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += Math.Round(i.XBCST, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.XBCST, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            //TempStr = StrWriter.GetKeyValStr("XBCST", XBCST.ToString());
            //ResultStr += TempStr;

            TempStr = "! YBCST =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += Math.Round(i.YBCST, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.YBCST, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            //TempStr = StrWriter.GetKeyValStr("YBCST", YBCST.ToString());
            //ResultStr += TempStr;

            TempStr = "! XECST =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += Math.Round(i.XECST, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.XECST, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            //TempStr = StrWriter.GetKeyValStr("XECST", XECST.ToString());
            //ResultStr += TempStr;

            TempStr = "! YECST =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += Math.Round(i.YECST, 3).ToString() + " ,";
                else
                    TempStr += Math.Round(i.YECST, 3).ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;

            //TempStr = StrWriter.GetKeyValStr("YECST", YECST.ToString());
            //ResultStr += TempStr;

            TempStr = "! NLB =";
            j = 0;
            foreach (Lake i in ArryLake)
            {
                if (j < ArryLake.Count - 1)
                    TempStr += i.NLB.ToString() + " ,";
                else
                    TempStr += i.NLB.ToString();
                j++;

            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            TempStr = "! METBXID =";
            j = 0;
            for (int k = 0; k < this.ArryLake.Count; k++)
            {
                j = 0;
                foreach (int i in this.ArryLake[k].METBXID)
                {
                    if (j < this.ArryLake[k].METBXID.Count - 1)
                    {
                        TempStr += i.ToString() + " ,";
                    }
                    else if (this.ArryLake.Count > 1)
                    {
                        TempStr += i.ToString() + " ,";
                    }
                    else
                    {
                        TempStr += i.ToString();
                    }
                    j++;

                }
            }
            if (this.ArryLake.Count <= 0)
            {
                TempStr += "0";
            }
            TempStr = TempStr.Trim();
            if (TempStr != "")
            {

                if (TempStr.Substring(TempStr.Length - 1, 1).Contains(","))
                {
                    TempStr = TempStr.Remove(TempStr.Length - 1, 1);
                }
            }
            TempStr += " !" + End;
            ResultStr += TempStr;


            TempStr = "! END !" + End;
            ResultStr += TempStr;

            TempStr = StrWriter.GetCLine();
            ResultStr += TempStr;



            return ResultStr;
        }

        public override void ReadFromGroup(Dictionary<string, string> dic)
        {
            foreach (KeyValuePair<string, string> m_dic in dic)
            {
                if (m_dic.Key == "ALPHA")
                {
                    this.ALPHA = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "BIAS")
                {
                    this.BIAS = StrWriter.ReturnDouList(m_dic.Value);
                }
                if (m_dic.Key == "CRITFN")
                {
                    this.CRITFN = Convert.ToDouble(m_dic.Value);
                }

                if (m_dic.Key == "DIVLIM")
                {
                    this.DIVLIM = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "FEXTR2")
                {
                    this.FEXTR2 = StrWriter.ReturnDouList(m_dic.Value);
                }
                if (m_dic.Key == "ICALM")
                {
                    this.ICALM = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IDIOPT1")
                {
                    this.IDIOPT1 = Convert.ToInt32(m_dic.Value);
                }
                //
                if (m_dic.Key == "IDIOPT2")
                {
                    this.IDIOPT2 = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IDIOPT3")
                {
                    this.IDIOPT3 = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IDIOPT4")
                {
                    this.IDIOPT4 = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IDIOPT5")
                {
                    this.IDIOPT5 = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IEXTRP")
                {
                    this.IEXTRP = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IFRADJ")
                {
                    this.IFRADJ = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IGFMET")
                {
                    this.IGFMET = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IKINE")
                {
                    this.IKINE = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IOBR")
                {
                    this.IOBR = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IPROG")
                {
                    this.IPROG = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "ISLOPE")
                {
                    this.ISLOPE = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "ISTEPPGS")
                {
                    this.ISTEPPGS = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "ISURFT")
                {
                    this.ISURFT = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IUPT")
                {
                    this.IUPT = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IUPWND")
                {
                    this.IUPWND = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "IWFCOD")
                {
                    this.IWFCOD = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "KBAR")
                {
                    this.KBAR = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "LLBREZE")
                {
                    if (m_dic.Value == "T")
                    {
                        this.LLBREZE = true;
                    }
                    else
                    {
                        this.LLBREZE = false;
                    }

                }
                if (m_dic.Key == "LVARY")
                {
                    if (m_dic.Value == "T")
                    {
                        this.LVARY = true;
                    }
                    else
                    {
                        this.LVARY = false;
                    }
                }
                if (m_dic.Key == "NBAR")
                {
                    this.NBAR = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "NBOX")
                {
                    this.NBOX = Convert.ToInt32(m_dic.Value);
                    ArryLake.Clear();
                    for (int i = 0; i < this.NBOX; i++)
                    {
                        ArryLake.Add(new Lake());
                    }
                }
                if (m_dic.Key == "XG1")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].XG1 = a[i];
                    }
                }
                if (m_dic.Key == "XG2")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].XG2 = a[i];
                    }
                }
                if (m_dic.Key == "YG1")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].YG1 = a[i];
                    }
                }
                if (m_dic.Key == "YG2")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].YG2 = a[i];
                    }
                }
                if (m_dic.Key == "XBCST")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].XBCST = a[i];
                    }
                }
                if (m_dic.Key == "YBCST")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].YBCST = a[i];
                    }
                }
                if (m_dic.Key == "XECST")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].XECST = a[i];
                    }
                }
                if (m_dic.Key == "YECST")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].YECST = a[i];
                    }
                }

                if (m_dic.Key == "NINTR2")
                {
                    this.NINTR2 = StrWriter.ReturnIntList(m_dic.Value);
                }
                if (m_dic.Key == "NITER")
                {
                    this.NITER = Convert.ToInt32(m_dic.Value);
                }
                if (m_dic.Key == "NLB")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < a.Count; i++)
                    {
                        ArryLake[i].NLB = Convert.ToInt16(a[i]);
                    }
                }
                if (m_dic.Key == "METBXID")
                {
                    List<int> a = new List<int>();
                    a = StrWriter.ReturnIntList(m_dic.Value);
                    int P = 0;
                    for (int i = 0; i < ArryLake.Count; i++)
                    {
                        for (int j = 0; i < ArryLake[i].NLB; j++)
                        {
                            ArryLake[i].METBXID.Add(a[P]);
                            P = P + 1;
                        }
                    }
                }
                if (m_dic.Key == "RMIN2")
                {
                    this.RMIN2 = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "RMAX1")
                {
                    this.RMAX1 = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "RMAX2")
                {
                    this.RMAX2 = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "RMAX3")
                {
                    this.RMAX3 = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "RMIN")
                {
                    this.RMIN = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "TERRAD")
                {
                    this.TERRAD = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "R1")
                {
                    this.R1 = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "R2")
                {
                    this.R2 = Convert.ToDouble(m_dic.Value);
                }
                if (m_dic.Key == "RPROG")
                {
                    this.RPROG = Convert.ToDouble(m_dic.Value);
                }

                if (m_dic.Key == "XBBAR")
                {
                    ArryBarrier.Clear();
                    for (int i = 0; i < StrWriter.ReturnDouList(m_dic.Value).Count; i++)
                    {
                        ArryBarrier.Add(new Barrier());
                    }
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < StrWriter.ReturnDouList(m_dic.Value).Count; i++)
                    {
                        ArryBarrier[i].XBBAR = a[i];
                    }
                }
                if (m_dic.Key == "YBBAR")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < StrWriter.ReturnDouList(m_dic.Value).Count; i++)
                    {
                        ArryBarrier[i].YBBAR = a[i];
                    }
                }
                if (m_dic.Key == "XEBAR")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < StrWriter.ReturnDouList(m_dic.Value).Count; i++)
                    {
                        ArryBarrier[i].XEBAR = a[i];
                    }
                }
                if (m_dic.Key == "YEBAR")
                {
                    List<double> a = new List<double>();
                    a = StrWriter.ReturnDouList(m_dic.Value);
                    for (int i = 0; i < StrWriter.ReturnDouList(m_dic.Value).Count; i++)
                    {
                        ArryBarrier[i].YEBAR = a[i];
                    }
                }
                if (m_dic.Key == "ZUPT")
                {
                    this.ZUPT = Convert.ToDouble(m_dic.Value);
                }

            }
        }
    }
}
